#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Taotie Ren
# import logging 
# 禁用日志模块
# logging.disable(logging.CRITICAL)
# logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')

# mouseNow.py - Dispaly the mouse cursor`s current position.
import pyautogui
# pyautogui.PAUSE = 1
# pyautogui.FAILSAFE = True
print('Press Ctrl-C to quit.')

try:
	while True:
		# Get and print the mouse coordinates.
		x, y = pyautogui.position()
		positionStr = 'X: ' + str(x).rjust(4) + 'Y: ' + str(y).rjust(4)
		pixelColor = pyautogui.screenshot().getpixel((x, y))
		positionStr += 'RGB: (' + str(pixelColor[0]).rjust(3)
		positionStr += ', ' + str(pixelColor[1]).rjust(3)
		positionStr += ', ' + str(pixelColor[2]).rjust(3) + ')'
		print(positionStr, end='')
		print('\b' * len(positionStr), end='', flush=True)

except KeyboardInterrupt:
	print('\nDone.')

